package wicket.example.utils;

import java.util.ArrayList;
import java.util.List;

public class SelectableObjectUtils
{

   private SelectableObjectUtils()
   {
   }

   public static final <C> List<ISelectable<C>> createSelectableList(final List<C> list)
   {
      List<ISelectable<C>> selectableList = SelectableListUtils.createList(list);
      return selectableList;
   }

   private static class SelectableListUtils
   {

      public static final <T extends List<C>, C> List<ISelectable<C>> createList(T list)
      {
         return createSelectableObjectList(list);
      }

      private static final <T extends List<C>, C> List<ISelectable<C>> createSelectableObjectList(List<C> list)
      {
         List<ISelectable<C>> resultList = new ArrayList<ISelectable<C>>();
         for (C listEntry : list)
         {
            ISelectable<C> resultEntry = new SimpleSelectableObject<C>(listEntry, false);
            resultList.add(resultEntry);
         }
         return resultList;
      }

   }

}
